package com.walleipt.ipt_tools.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class PropertiesReader {

	private static final Logger LOG = LoggerFactory.getLogger(PropertiesReader.class);

	public static String getWebConfig(String key){
		String str = "";
		try {
			Properties p = new Properties();
			InputStream inputStream = PropertiesReader.class.getResourceAsStream("/config.properties");
			BufferedReader bf = new BufferedReader(new InputStreamReader(inputStream,"UTF-8"));
			p.load(bf);

			str=p.getProperty(key);
		} catch (IOException e) {
			LOG.error(e.getMessage(),e);
		}

		return str;
	}

	public static void main(String[] args)throws Exception {
		String r = getWebConfig("NET.RSA.PRIVATEKEY.XML");
		System.out.println(r);
	}
}
